﻿@{
    ViewData["Title"] = "基础数据";
}

<div class="panel panel-default">
    <div class="form-content">
        <div class="form-body">
            <div id="toolbar" class="row" data-toggle="form" data-field="Parameter" data-grid="#grid" data-filterable="true">
                <input data-field="key,value,text,parent.key,parent.text" data-size="4,0,12" data-logic="or" data-operator="contains" />
                <button data-button="query">查询</button>
                <button data-button="clear">清除条件</button>
                <div class="pull-right" style="padding-right:15px;">
                    <button data-button="add" data-popup="ParameterEdit">新 增</button>
                </div>
            </div>
            <div id="grid" data-toggle="grid" data-form="#toolbar" node="grid" data-related='#_PopupParameterDetail'>
                <div node="columns" node-type="array">
                    <span data-field="index" data-title="序号"></span>
                    <span data-field="_parent.text" data-title="父项"></span>
                    <span data-field="key" data-title="数据项"></span>
                    <span data-field="value" data-title="数据值"></span>
                    <span data-field="text" data-title="显示文本"></span>
                    <span data-field="createdOn" data-title="创建时间" data-type="datetime"></span>
                </div>
                <span node="dataSource">
                    <span node="transport">
                        <span node="read" data-url="/odata/parameters?$expand=parent($select=id,text)">
                        </span>
                    </span>
                    <span node="sort" data-field="index" data-dir="asc"></span>
                </span>
            </div>
        </div>
    </div>
</div>

<div id="_PopupParameterDetail" data-toggle="popup" data-type="ParameterDetail" data-title="基础数据" data-size="small">
    <div class="popup-content" data-toggle="form" data-field="Parameter" data-detailable="true">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-body">
                    <span data-field="_parent.text" data-label="父项"></span>
                    <span data-field="index" data-label="序号"></span>
                    <span data-field="key" data-label="数据项"></span>
                    <span data-field="value" data-label="数据值"></span>
                    <span data-field="text" data-label="显示文本"></span>
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="edit" data-popup="ParameterEdit">编 辑</button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>

<div id="_PopupParameterEdit" data-toggle="popup" data-type="ParameterEdit" data-title="基础数据" data-size="small" data-related="#toolbar">
    <div class="popup-content" data-toggle="form" data-field="Parameter" data-editable="true" data-url="/api/parameters" data-size="12,3,8">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-body">
                    <select data-field="parentId" data-label="父项" data-role="kendoDropDownList" data-side="server" data-url="/odata/parameters?$select=id,text&$filter=index le 999&$orderby=index" data-data-value-field="id" data-data-text-field="text"></select>
                    <input data-field="index" data-label="序号" required data-size="12,3,4" data-role="kendoNumericTextBox" data-min="0" data-max="999999" data-value="0" data-format="n0" />
                    <input data-field="key" data-label="数据项" required />
                    <input data-field="value" data-label="数据值" required />
                    <input data-field="text" data-label="显示文本" required />
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="post" data-success-text="新增成功">新 增</button>
            <button data-button="put" data-success-text="保存成功">提 交</button>
            <button data-button="delete" data-success-text="删除成功">删 除</button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>